﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace E1_eMart.user
{
    public partial class BiddingSuccessful : System.Web.UI.Page
    {
        public TaiKhoan account = new TaiKhoan();       
        protected int loaiTaiKhoan = -1;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] == null)
            {
                return;
            }
            account = ((TaiKhoan)Session["username"]);
            loaiTaiKhoan = (int)account.MaLoaiTaiKhoan;
        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lbTenSP = (Label)e.Row.FindControl("lbTenSP");
                Label lbLoaiSP = (Label)e.Row.FindControl("lbLoaiSP");
                Label lbMoTaSP = (Label)e.Row.FindControl("lbMoTaSP");
                int msp = (int)GridView1.DataKeys[e.Row.RowIndex][1];
                DataClasses1DataContext edata = new DataClasses1DataContext();
                var itemQuery1 = from sp in edata.SanPhams
                                 where sp.MaSanPham == msp
                                 select sp;
                SanPham sanPham = new SanPham();
                sanPham = itemQuery1.ToList()[0];
                lbTenSP.Text = sanPham.TenSanPham;
                lbLoaiSP.Text = sanPham.LoaiSanPham.TenLoaiSanPham;
                lbMoTaSP.Text = sanPham.MoTaSanPham;
            }
        }
    }
}